package com.huike.web.controller.report;


import com.huike.common.core.domain.AjaxResult;
import com.huike.report.domain.vo.IndexTodayInfoVO;
import com.huike.report.domain.vo.IndexTodoInfoVO;
import com.huike.report.service.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;

    /**
     * 首页--基础数据统计
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime, endCreateTime));
    }

    //今日报表
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){
        IndexTodayInfoVO todayInfo = reportService.getTodayInfo();
        return AjaxResult.success("操作成功",todayInfo);
    }

    //今日待办
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(String beginCreateTime,String endCreateTime){
        IndexTodoInfoVO todoInfo = reportService.getTodoInfo(beginCreateTime, endCreateTime);
        return AjaxResult.success("操作成功",todoInfo);
    }

    //首页 - 商机转化龙虎榜
    @GetMapping("/businessChangeStatistics")
    public AjaxResult getBusinessChangeStatistics(String beginCreateTime,String endCreateTime){

        return AjaxResult.success("操作成功",reportService.getBusinessChangeStatistics(beginCreateTime, endCreateTime));
    }

    //首页 - 线索转化龙虎榜
    @GetMapping("/salesStatistic")
    public AjaxResult getClueChangeStatistics(String beginCreateTime,String endCreateTime){

        return AjaxResult.success("操作成功",reportService.getClueChangeStatistics(beginCreateTime, endCreateTime));
    }
}